﻿using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using AdAggregator.SearchData;
using RealEstateAggregator.Utils;
using SortingDirection = RealEstateAggregator.Utils.SortingDirection;

namespace RealEstateAggregator.Models.SearchData
{
    public class MySearchData : BaseSearchData
    {
        public MySearchData()
        {
            Page = 1;
        }

        [DisplayName("Województwo")]
        public String Voivodship { get; set; }

        [DisplayName("Miasto")]
        public String City { get; set; }

        [DisplayName("Dzielnica")]
        public String District { get; set; }

        [DisplayName("Ulica")]
        public String Street { get; set; }

        [DisplayName("Typ ogłoszenia")]
        public AdvertisementType AdvertisementType { get; set; }

        [DisplayName("Typ nieruchomości")]
        public EstateType EstateType { get; set; }

        [DisplayName("Rynek")]
        public MarketType MarketType { get; set; }

        public decimal PriceMin { get; set; }

        public decimal PriceMax { get; set; }

        public decimal PricePerMeterMin { get; set; }

        public decimal PricePerMeterMax { get; set; }

        public decimal AreaMin { get; set; }

        public decimal AreaMax { get; set; }

        public int RoomCountMin { get; set; }

        public int RoomCountMax { get; set; }

        public int? FloorMin { get; set; }

        public int? FloorMax { get; set; }

        public int YearBuiltMin { get; set; }

        public int YearBuiltMax { get; set; }

        [DisplayName("Słowa kluczowe")]
        public String Keywords { get; set; }

        [DisplayName("Tylko ze zdjęciem")]
        public bool OnlyWithPhoto { get; set; }

        public override ISearchData Copy()
        {
            var copy = new MySearchData();
            copy.AdvertisementType = AdvertisementType;
            copy.AreaMax = AreaMax;
            copy.AreaMin = AreaMin;
            copy.City = City;
            copy.District = District;
            copy.EstateType = EstateType;
            copy.FloorMax = FloorMax;
            copy.FloorMin = FloorMin;
            copy.Keywords = Keywords;
            copy.MarketType = MarketType;
            copy.OnlyWithPhoto = OnlyWithPhoto;
            copy.OrderBy = OrderBy;
            copy.Page = Page;
            copy.PriceMax = PriceMax;
            copy.PriceMin = PriceMin;
            copy.PricePerMeterMax = PricePerMeterMax;
            copy.PricePerMeterMin = PricePerMeterMin;
            copy.RoomCountMax = RoomCountMax;
            copy.RoomCountMin = RoomCountMin;
            copy.SortingDirection = SortingDirection;
            copy.Street = Street;
            copy.Voivodship = Voivodship;
            copy.YearBuiltMax = YearBuiltMax;
            copy.YearBuiltMin = YearBuiltMin;
            return copy;
        }
    }
}